#ifndef STX_ALGORITHM_ALL_OF_HPP
#define STX_ALGORITHM_ALL_OF_HPP

#include <stx/algorithm/common.hpp>

namespace stx {

template <class InputIterator, class Predicate>
inline bool
all_of(InputIterator first, InputIterator last, Predicate pred)
{
    for (; first != last; ++first) {
        if (!pred(*first)) {
            return false;
        }
    }
    return true;
}

template<class Container, class Predicate>
inline bool
all_of(const Container& c, Predicate pred)
{
    return stx::all_of(stx::begin(c), stx::end(c), pred);
}

template <class InputIterator, class Predicate>
inline bool
all_of(stx::iterator_range<InputIterator> r, Predicate pred)
{
    return all_of(stx::begin(r), stx::end(r), pred);
}

} // namespace stx

#endif // STX_ALGORITHM_ALL_OF_HPP
